package utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @ author 韩
 * time: 2024/10/29 20:35
 */

public class CheckUtils {

    public static boolean theStringIsLong(String string) {
        try {
            Long.parseLong(string);
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
    }

    public static boolean isEmail(String email) {
        // 定义邮箱格式的正则表达式
        String regex = "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(email);
        return matcher.matches();
    }

}
